package cn.com.xyzq.reks.model;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
import org.appfuse.model.BaseObject;

@Entity
@Table(name = "company_fund")
@XmlRootElement
public class CompanyFund extends BaseObject implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 8206123853909869161L;

	private Long id;
	private String code;
	private String name;
	private String company;
	private String factCompany;
	private String type;
	private String market;
	private String relation;
	private Double rate;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	public Long getId() {
		return id;
	}

	@Column(name = "code", length = 20)
	public String getCode() {
		return code;
	}

	@Column(name = "name", length = 50)
	public String getName() {
		return name;
	}

	@Column(name = "code", length = 50)
	public String getCompany() {
		return company;
	}

	@Column(name = "factCompany", length = 50)
	public String getFactCompany() {
		return factCompany;
	}

	@Column(name = "type", length = 50)
	public String getType() {
		return type;
	}

	@Column(name = "market", length = 50)
	public String getMarket() {
		return market;
	}

	@Column(name = "relation", length = 50)
	public String getRelation() {
		return relation;
	}

	@Column(name = "rate", precision = 2, scale = 2)
	public Double getRate() {
		return rate;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public void setName(String name) {
		this.name = name;
	}

	public void setCompany(String company) {
		this.company = company;
	}

	public void setFactCompany(String factCompany) {
		this.factCompany = factCompany;
	}

	public void setType(String type) {
		this.type = type;
	}

	public void setMarket(String market) {
		this.market = market;
	}

	public void setRelation(String relation) {
		this.relation = relation;
	}

	public void setRate(Double rate) {
		this.rate = rate;
	}

	@Override
	public String toString() {
		// TODO Auto-generated method stub
		return new ToStringBuilder(this, ToStringStyle.DEFAULT_STYLE)
				.append("code", code).append("name", name)
				.append("company", company).append("fact Company", factCompany)
				.append("type", type).append("market", market)
				.append("relation", relation).append("rate", rate).toString();
	}

	@Override
	public boolean equals(Object o) {
		// TODO Auto-generated method stub
		if (this == o) {
			return true;
		}
		if (!(o instanceof CompanyFund)) {
			return false;
		}
		CompanyFund cf = (CompanyFund) o;
		return this.hashCode() == cf.hashCode();
	}

	@Override
	public int hashCode() {
		// TODO Auto-generated method stub
		int result;
		result = (id != null ? id.hashCode() : 0);
		result = 29 * result + (code != null ? code.hashCode() : 0);
		result = 29 * result + (name != null ? name.hashCode() : 0);
		result = 29 * result + (company != null ? company.hashCode() : 0);
		result = 29 * result
				+ (factCompany != null ? factCompany.hashCode() : 0);
		result = 29 * result + (type != null ? type.hashCode() : 0);
		result = 29 * result + (market != null ? market.hashCode() : 0);
		result = 29 * result + (relation != null ? relation.hashCode() : 0);
		result = 29 * result + (rate != null ? rate.hashCode() : 0);
		return result;
	}

}
